package com.example.demo.controller;

import com.example.demo.pojo.PageResult;
import com.example.demo.pojo.Remittance;
import com.example.demo.pojo.Result;
import com.example.demo.service.Impl.RemittanceServiceImpl;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/admin")
public class RemittanceController {
    @Autowired
    private RemittanceServiceImpl remittanceService;
    //汇款列表查询
    //汇款总数查询
    @GetMapping("/remittance")
    public Result remittanceSelect(@RequestParam(defaultValue = "1") Integer page,
                                   @RequestParam(defaultValue = "10") Integer limit,
                                    Remittance remittance){
        PageInfo list = remittanceService.remittanceSelect(page,limit,remittance);
        return PageResult.success03(list.getList(), (int) list.getTotal());
    }
    //汇款记录删除
    @DeleteMapping("/remittance")
    public Result remittanceDelete(Integer id){
        remittanceService.remittanceDelete(id);
        return Result.success("删除成功");
    }
}
